package com.netease.nim.demo.session.audio;

import com.netease.nim.demo.common.media.audioplayer.Playable;
import com.netease.nim.demo.util.storage.StorageType;
import com.netease.nim.demo.util.storage.StorageUtil;


public class AudioPlayable implements Playable {

	private long id;
	private String name;
	

	public AudioPlayable(long id, String name) {
		this.id = id;
		this.name = name;
	}

	public String getName() {
		return name;
	}

	public long getId() {
		return id;
	}

	@Override
	public long getDuration() {
		return 0;
	}

	@Override
	public String getPath() {
		return StorageUtil.getWritePath(name, StorageType.TYPE_AUDIO);
	}

	@Override
	public boolean isAudioEqual(Playable audio) {
		if (audio instanceof AudioPlayable) {
			AudioPlayable other = (AudioPlayable) audio;
			String otherName = other.getName();
			if (name != null && name.equals(otherName)) {
				return true;
			}
		}

		return false;
	}

}
